﻿-var permissions = ViewData["permissions"] as List<Permission>
-var users = ViewData["users"] as List<User>
-var userspermissions = ViewData["userspermissions"] as List<UserPermission>
#content
  %form.tableform{action=String.Format("user.ivp/userspermissions"),method="post"}
    %h1
      %img.icon24{src="img/headericons/role.gif"} 
      Полномочия
    #tableholder            
      %table.data
        %tr.top
          %th{width="1%"}
          %th{width="20%"} <a href="javascript:orderBy('Name')">Имя</a>
          -foreach(var p in permissions)
            %th.center{width="1%"}
              =p.Name
              /%img{src=String.Format("img/permissions/{0}",p.Image16), class="icon16", title=p.Name, alt=p.Name}
        -bool odd = true
        -foreach(var u in users)
          -odd = !odd
          %tr{class=odd?"odd":""}
            %td
            %td{id = u.Id}
              %a.noul{href="#", onclick=String.Format("return loadUserPermission({0}, this);", u.Id)}
                =u.FIO
            -foreach(var p in permissions)
              %td.center=(userspermissions.Exists(up => up.UserId == u.Id && up.PermissionId == p.Id) ? "Да" : "Нет" )
      .spacer10
      .spacer10
                
          
